package com.haidechizi.leetcode;

/**
 * @author: wangdejun
 * @create: 2020-04-03 10:38
 **/
public class _17_打印从1到最大的n位数 {

    public int[] printNumbers(int n) {
        // n位的最大数
        StringBuilder sb = new StringBuilder();
        while (n > 0) {
            sb.append("9");
            n--;
        }
        int max = Integer.parseInt(sb.toString());
        int[] result = new int[max];

        for (int i = 0; i < max; i++) {
            result[i] = i + 1;
        }
        return result;

    }
}
